<template>
  <div class="search">
    <search-input v-model="query" />
  </div>
</template>

<script>
import { onMounted, ref } from 'vue'
import SearchInput from '@/components/search/search-input.vue'
import { getHotKeys, search } from '@/service/search'
// import { search } from '@/service/search'
export default {
  components: {
    SearchInput
  },
  setup (props) {
    const query = ref('')
    const page = ref(1)
    // const hotKeys = ref([])

    getHotKeys().then((result) => {
      console.log(result)
      // hotKeys.value = result.hotKeys
    })
    const searchFirst = async () => {
      page.value = 1
      await search(query.value, page.value, true)
    }
    onMounted(() => {
      searchFirst()
    })
    return { query }
  }
}
</script>

<style scoped></style>
